Skip to content

[MM] Remove text components from ProcessorInputs - #53093

Open
DarkLight1337 wants to merge 9 commits into
vllm-project:mainfrom
DarkLight1337:rm-text-input
Open

[MM] Remove text components from ProcessorInputs#53093
DarkLight1337 wants to merge 9 commits into
vllm-project:mainfrom
DarkLight1337:rm-text-input

Conversation

@DarkLight1337

@DarkLight1337 DarkLight1337 commented Aug 20, 2026

Copy link
Copy Markdown
Member

PLEASE FILL IN THE PR DESCRIPTION HERE ENSURING ALL CHECKLIST ITEMS (AT THE BOTTOM) HAVE BEEN CONSIDERED.

Purpose

Follow-up to #53064

Even for the text input path in AsyncLLM, the prompt is tokenized before being passed to MM processor, so the text path in MM processor is now dead code and can be removed. This PR starts the process by removing text prompt and tok_kwargs from ProcessorInputs.

In the next PR I will simplify _apply_hf_processor_main by upgrading to transformers>=5.10.4 which allows us to pass MM data without any need for dummy text.

Test Plan

Test Result


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

BEFORE SUBMITTING, PLEASE READ https://docs.vllm.ai/en/latest/contributing (anything written below this line will be removed by GitHub Actions)

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@mergify mergify Bot added cohere Related to Cohere models deepseek Related to DeepSeek models llama Related to Llama models multi-modality Related to multi-modality (#4194) mistral Related to Mistral models qwen Related to Qwen models kimi k3 glm minimax inkling labels Aug 20, 2026
@DarkLight1337

Copy link
Copy Markdown
Member Author

@claude review

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
@mergify

mergify Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Documentation preview: https://vllm--53093.org.readthedocs.build/en/53093/

@mergify mergify Bot added the documentation Improvements or additions to documentation label Aug 20, 2026
Comment thread vllm/multimodal/processing/processor.py
Comment thread vllm/multimodal/processing/dummy_inputs.py
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
@DarkLight1337

Copy link
Copy Markdown
Member Author

@claude review

Comment thread vllm/model_executor/models/transformers/multimodal.py
Comment thread vllm/model_executor/models/transformers/multimodal.py Outdated
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
@DarkLight1337

Copy link
Copy Markdown
Member Author

@claude review

Comment thread vllm/model_executor/models/transformers/multimodal.py Outdated
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
@DarkLight1337

Copy link
Copy Markdown
Member Author

@claude review

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beyond the inline nit, I also checked the dummy-input tokenization path in vllm/multimodal/processing/dummy_inputs.py for the profiling-tokenizer-truncation concern raised by finders (the old code explicitly set tokenization_kwargs={"truncation": False}, while the new path uses default_tok_params.get_encode_kwargs()). The default encode kwargs resolve max_length to max_model_len + 1, which is at least as large as any dummy prompt built for profiling at that seq_len, so this doesn't truncate or undercount placeholder tokens in practice.

Extended reasoning...

Reviewed the two dummy-input-tokenization candidate issues from this run's finder/verifier pass (potential truncation/undercounting of placeholder tokens during memory profiling in dummy_inputs.py). Traced default_tok_params.get_encode_kwargs() (vllm/renderers/params.py) and confirmed the resolved max_length is max_model_len + 1, which does not truncate the dummy prompts built for profiling at a given seq_len, matching the verifier's conclusion that this is not a regression.

Comment thread vllm/model_executor/models/transformers/multimodal.py
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
@DarkLight1337

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #84835 for commit a50c678f131f.

@Isotr0py Isotr0py left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, let's make token in / token out now!

Comment on lines +86 to +97
tokenizer = self.info.ctx.tokenizer
dummy_prompt: list[int]
if tokenizer is None:
# Tokenizer-less models (e.g. `skip_tokenizer_init=True`) only
# accept embeddings and have an empty dummy text, so there are no
# prompt tokens.
dummy_prompt = []
else:
dummy_prompt = tokenizer.encode(
dummy_text,
**self.info.default_tok_params.get_encode_kwargs(),
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although not in a hurry, should we deprecate get_dummy_text and use token ids for dummy data construction directly in the future and fully avoid text inputs?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I am planning to do that in the next PR

Comment on lines 1265 to +1270
def _apply_hf_processor_text_mm(
self,
prompt_text: str,
mm_items: MultiModalDataItems,
hf_processor_mm_kwargs: Mapping[str, object],
tokenization_kwargs: Mapping[str, object],
) -> tuple[list[int], BatchFeature, bool]:
) -> tuple[list[int], BatchFeature]:

@Isotr0py Isotr0py Aug 20, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I'm reconsidering whether we should rely on hf processor.

Maybe we can just call image processr / video processor / audio processor on demand one by one after token-only inputs refactoring. Then the multimodal processor logic will be much simpler.🤔

@DarkLight1337 DarkLight1337 Aug 20, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we could do that as well. That way custom code on HF Hub repos before transformers 5.10 would continue to work. This is also planned for the next PR

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
@DarkLight1337

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #84859 for commit a486b51386b3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-docs cohere Related to Cohere models deepseek Related to DeepSeek models documentation Improvements or additions to documentation glm inkling k3 kimi llama Related to Llama models minimax mistral Related to Mistral models multi-modality Related to multi-modality (#4194) qwen Related to Qwen models ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants